




// 标签hover色彩
// var tagColors = ["#CFCACA",'#CED3CF','#BFCDCD','#C4DAD5','#C4EACD','#FDD12D','#D1CB6D','#E3D670','#CDCDB4','#CD919E','#C2C1BC','#B3B2A3','#83838D','#2C464F','#FFB2A8','#C2AFA1','#8C7E7E','#CDB5CD','#C9B96F','#B6985B'];
// var tagColorsLen = tagColors.length;
// for(var i = 0; i<=$(".colorTags").length; i++){
//     var index = Math.ceil(Math.random()*tagColorsLen);
//     $(".colorTags").eq(i-1).css({"background":tagColors[index-1]})
// }
// 轮播图
var slider = function(){
    var iCur = 0 , ul = $('.ib-bd-img>ul') , lis = ul.children() , len = lis.length , activeClass = 'on', fx = 'easeInSine' , speed = 400, duration = 6000,
        btnList = $('.ib-hd-btns .hd li') , btnPrev = $('.ib-hd-btns .prev') , btnNext = $('.ib-hd-btns .next'),
        timer = null;
    var skip = function(pr,ne){
        ul.stop(true,false).animate({left : -ne * 100 + '%'},speed,fx);
        iCur = ne;
        btnList.eq(iCur).addClass(activeClass).siblings().removeClass(activeClass);
        $('.ib-bd-word li').eq(iCur).show().siblings().hide();
    }
    var start = function(){
        timer = setInterval(function(){
            btnNext.trigger('click');
        },duration);
    }
    var clone = lis.first().clone();
        clone.appendTo(ul);
    var cloneImage = clone.find('img');
    cloneImage.attr('src',cloneImage.data('original'));
    ul.css('width',(len + 1) * 100 + '%');

    btnList.hover(function(){
        var index = $(this).index();
        
        skip(iCur,index);
    });
    btnPrev.click(function(){
        if(ul.is(':animated')) return;
        if(iCur - 1 < 0){
            ul.css('left', -len * 100 + '%');
            skip(iCur,len-1);
        }else{
            skip(iCur,iCur-1);
        }
    });
    btnNext.click(function(){
        if(ul.is(':animated')) return;
       iCur++;
        if(iCur + 1 > len){
            iCur = 0;
            ul.stop(true,false).animate({left : -len * 100 + '%'},speed,fx,function(){
             $(this).css('left' , 0);
            });
         }else{
            ul.stop(true,false).animate({left : -iCur * 100 + '%'},speed,fx);
         }
       btnList.eq(iCur).addClass(activeClass).siblings().removeClass(activeClass);
       $('.ib-bd-word li').eq(iCur).show().siblings().hide();
    });
    start();
    var ctimer = null;
    $('.idx-banner').hover(function(){
        clearTimeout(ctimer);
        clearInterval(timer);
    },function(){
        ctimer = setTimeout(start,100);
    });
}
slider();


$('.ib-bd-img a.video-item').click(function(){
    lp_showVideo.call(this,$(this).data('src'));
});

$(function(){
    $("#lp-overlay").click(function(){
    closeVideo();
    });

    $('.ib-bd-img li .video-item').hover(function(){
        $(this).find('i').show().addClass('videoRotate')
         $(this).find('em').show();
         $(this).css('background',"#000");
    },function(){
        $(this).find('i').hide().removeClass('videoRotate')
         $(this).find('em').hide();
         $(this).css('background',"transparent");
    });
});
